package com.qfedu.controller;

import com.qfedu.entity.Collect;
import com.qfedu.entity.ResponseData;
import com.qfedu.service.CollectService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/collection")
public class CollectController {

    @Autowired
    private CollectService collectService;

    /**
     * 返回的指定用户ID的收藏列表
     * @param collect
     * @return
     */
    @RequestMapping("/detail")
    public List<Collect> getCollection(Collect collect){

        System.out.println("collect = " + collect);
        return collectService.getCollection(collect);
    }

    /**
     * 添加收藏的歌曲 type: 0 代表歌曲， 1 代表歌单
     * @param collect
     * @return
     */
    @RequestMapping("/add")
    public ResponseData<String> setCollection(Collect collect){

        return collectService.setCollection(collect);
    }

    @RequestMapping("/delete")
    public ResponseData<String> deleteCollection(Collect collect) {

        return collectService.deleteCollection(collect);

    }
}
